home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
UTILITY
/
DO1002.ARJ
/
INKEY.SCR
< prev
next >
Wrap
Text File
|
1991-12-13
|
1KB
|
42 lines
.pg wi full clr cy
COMMAND NAME»gray«: »%t« InKey »ye«
/INKEY [{key}] [{label}]
/cw
»%t«InKey»#« tests to see if you have pressed a key and
returns that key in the variable »%t«CHAR»#«. If »cy«{key}»#« is
specified then the key pressed must match that key otherwise
»ye«CHAR»#« is set to »re«NULL»#« ("").
»%t«InKey»#« will jump to the specified »cy«{label}»#« if »cy«{key}»#« is »re«NULL»#« ("")
or the key pressed equals »cy«{key}»#«.
.pg
This feature is most often used in »gr«loops»#« where you wish to display
something or simply want to give the user a chance to abort the
loop. For example, the following code displays the time:
»cy«
.clr
:Time
.go 1 1 reset
{time} Press <esc> to abort
»%t«/INKEY»ye« ~~»cy«027 End
.go 1 5
You pressed %%CHAR
/GOTO Time
:End
»#«
Notice that we have used the »ye«tilde»#« notation to put in the decimal
equivalent for the »bo«<esc>»#« key. Now we'll run this code for you:
.pg clr
:Time
»go 1 1 reset«{time} Press »bo«<esc>»#« to abort
/INKEY ~027 End
»go 1 5 reset«You pressed %CHAR
/GOTO Time
:End
»go 1 7«The loop ended when you pressed »bo«<esc>»#«.
/ENDEXEC CLEAR